<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        //优点：可以传递参数，而且不共享父类原型的引用属性
        //优点：每份子类原型有一份多余父类属性
        function Father(name, age) {
            this.name = name;
            this.age = age;
            this.arr = [1, 2, 3];
        }

        function Child(name, age) {
            Father.call(this, name, age);
        }

        let child1 = new Child('zby', 18);
        let child2 = new Child('zq', 40);
        console.log(child1);
        console.log(child2);
        child1.arr.push(1);
        console.log(child1.arr);
        console.log(child2.arr);
    </script>
</body>

</html>